#ifndef CDRAWENGINE_H
#define CDRAWENGINE_H

#include "IDrawEngine.h"
#include <QPainter>

using namespace csmodel;

class IMapDrawEngine : public IDrawEngine
{
public:
    virtual void SetColor( const QColor & c ) = 0;
};


class CDrawEngine : public IMapDrawEngine
{
    QPainter * c;
    float scale;
    int dx;
    int dy;
    QRect drawingArea;
    float scaleFont;
    int DotSize;

public:
    virtual void SetColor( const QColor & color );
    virtual void Box( const QRect & box );
    virtual void BoxIN( const QRect & box );
    virtual void BoxOUT( const QRect & box );
    virtual void SelectionBox( const QRect & box );
    virtual void Arrow( const QPoint & p1, const QPoint & p2 );
    virtual void ArrowNonFilled( const QPoint & p1, const QPoint & p2 );
    virtual void Ellipse( const QRect & d );
    virtual void Line( const QPoint & p1, const QPoint & p2 );
    virtual void OutText( const QPoint & p, int sz, const QString & msg );
    virtual const QRect & DrawingArea() const throw();
    virtual void SetTextHeight( int height );
    virtual void SetTextSize( int size );
    virtual int GetTextWidth( const QString & text );
    virtual int GetTextHeight( const QString & text );
    virtual QPoint GetTextExtents( const QString & text );
    virtual void DrawText( const QPoint & p, const QString & text, bool transparent );
    float Scale() const { return scale; }
    void Scale( float v ) { scale = v; }

    CDrawEngine( QPainter * _c, float _scale, int _dx, int _dy, const QRect & _drawingArea, float _scaleFont = 1.0f, int _dotSize = 2 )
        : c ( _c ), scale(_scale), dx(_dx), dy(_dy), drawingArea(_drawingArea), scaleFont(_scaleFont)
    {
        SetDotSize(_dotSize);
    }

    void SetDotSize( int _size ) { DotSize = _size; }
};

#endif // CDRAWENGINE_H
